/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2011 All Rights Reserved.
 */
package com.liwei.nio.mina;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/** 
 * Provides {@link ProtocolEncoder} and {@link ProtocolDecoder} which translates 
 * binary or protocol specific data into message object and vice versa. 
 * <p> 
 * Please refer to 
 * <a href="../../../../../xref-examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.html" mce_href="xref-examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.html"><code>ReverserProtocolProvider</code></a> 
 * example. 
 * 
 * @author lidian
 * @version $Id: ProtocolCodecFactory.java, v 0.1 2011-1-27 上午10:09:59 lidian Exp $
 */
public interface ProtocolCodecFactory {
    /** 
     * Returns a new (or reusable) instance of {@link ProtocolEncoder} which 
     * encodes message objects into binary or protocol-specific data. 
     */
    ProtocolEncoder getEncoder(IoSession session) throws Exception;

    /** 
     * Returns a new (or reusable) instance of {@link ProtocolDecoder} which 
     * decodes binary or protocol-specific data into message objects. 
     */
    ProtocolDecoder getDecoder(IoSession session) throws Exception;
}
